package com.cn.qgx428.lazydiary


import android.app.TimePickerDialog
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import android.widget.TimePicker
import com.cn.qgx428.lazydiary.network.Imageloader
import com.cn.qgx428.lazydiary.prump.ClockManager
import com.cn.qgx428.lazydiary.prump.clock.StikyNoteClock
import com.cn.qgx428.lazydiary.prump.service.ClockService

import com.cn.qgx428.lazydiary.ui.activity.BaseActivity
import com.cn.qgx428.lazydiary.ui.activity.GuideActivity
import com.cn.qgx428.lazydiary.ui.activity.HomeActivity
import kotlinx.android.synthetic.main.activity_main.*
import org.jetbrains.anko.startActivity

class MainActivity : BaseActivity() {

    // 模拟器访问地址
   // val url:String = "http://10.0.2.2/lazyDiary/App/User/index"
    // 真机访问地址
    val url:String = "http://10.17.65.235/lazyDiary/App/User/index"

    override fun initUI() {

    }
    fun SharedPreferences.currentUserId() = {
        "1"
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        btnToGuide.setOnClickListener({startActivity<GuideActivity>()})
        btnToHome.setOnClickListener({startActivity<HomeActivity>()})
        btnToDialog.setOnClickListener({  getTimePickerDialog(object : TimePickerDialog.OnTimeSetListener{
            override fun onTimeSet(view: TimePicker?, hourOfDay: Int, minute: Int) {

            }
        }).show()  })

        //save()
     //  get()
        downImageTest()

    }

    fun downImageTest(){
        Imageloader.download(this, img,"test3")
    }

    fun save(){

    }

    fun get() {
//        var clock = StikyNoteClock()
//        clock.alarm()
        ClockManager.getNextClock()?.alarm()
    }
}
